home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Devil's Cubes 1.0.1 / source / Devil’s Cubes ƒ / Cube code / cube meat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.9 KB  |  97 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        cube meat.c
  4.  
  5. Purpose:    This module handles internal variable manipulation for
  6.             keeping track of cube rotations.
  7.  
  8.  
  9. Devil’s Cubes -- a simple cubes puzzle
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "cube meat.h"
  30. #include "cube.h"
  31.  
  32. void Qrotate(int i)
  33. {
  34.     int            temp;
  35.     
  36.     temp=Cube[i][4];
  37.     Cube[i][4]=Cube[i][1];
  38.     Cube[i][1]=Cube[i][5];
  39.     Cube[i][5]=Cube[i][3];
  40.     Cube[i][3]=temp;
  41. }
  42.  
  43. void Xrotate(int i)
  44. {
  45.     int            temp;
  46.     
  47.     temp=Cube[i][4];
  48.     Cube[i][4]=Cube[i][3];
  49.     Cube[i][3]=Cube[i][5];
  50.     Cube[i][5]=Cube[i][1];
  51.     Cube[i][1]=temp;
  52. }
  53.  
  54. void Srotate(int i)
  55. {
  56.     int            temp;
  57.     
  58.     temp=Cube[i][0];
  59.     Cube[i][0]=Cube[i][5];
  60.     Cube[i][5]=Cube[i][2];
  61.     Cube[i][2]=Cube[i][4];
  62.     Cube[i][4]=temp;
  63. }
  64.  
  65. void Arotate(int i)
  66. {
  67.     int            temp;
  68.     
  69.     temp=Cube[i][0];
  70.     Cube[i][0]=Cube[i][4];
  71.     Cube[i][4]=Cube[i][2];
  72.     Cube[i][2]=Cube[i][5];
  73.     Cube[i][5]=temp;
  74. }
  75.  
  76. void Wrotate(int i)
  77. {
  78.     int            temp;
  79.     
  80.     temp=Cube[i][0];
  81.     Cube[i][0]=Cube[i][1];
  82.     Cube[i][1]=Cube[i][2];
  83.     Cube[i][2]=Cube[i][3];
  84.     Cube[i][3]=temp;
  85. }
  86.  
  87. void Zrotate(int i)
  88. {
  89.     int            temp;
  90.     
  91.     temp=Cube[i][0];
  92.     Cube[i][0]=Cube[i][3];
  93.     Cube[i][3]=Cube[i][2];
  94.     Cube[i][2]=Cube[i][1];
  95.     Cube[i][1]=temp;
  96. }
  97.